home *** CD-ROM | disk | FTP | other *** search
/ QRZ! Ham Radio 8 / QRZ Ham Radio Callsign Database - Volume 8.iso / mac / files / t_sys5 / 92052tar.gz / 920528.tar / udp.h < prev    next >
C/C++ Source or Header  |  1992-05-28  |  3KB  |  107 lines

  1. /* @(#) $Header: udp.h,v 1.6 92/05/28 13:50:41 deyke Exp $ */
  2.  
  3. #ifndef _UDP_H
  4. #define _UDP_H
  5.  
  6. #ifndef _GLOBAL_H
  7. #include "global.h"
  8. #endif
  9.  
  10. #ifndef _MBUF_H
  11. #include "mbuf.h"
  12. #endif
  13.  
  14. #ifndef _IFACE_H
  15. #include "iface.h"
  16. #endif
  17.  
  18. #ifndef _INTERNET_H
  19. #include "internet.h"
  20. #endif
  21.  
  22. #ifndef _IP_H
  23. #include "ip.h"
  24. #endif
  25.  
  26. #ifndef _NETUSER_H
  27. #include "netuser.h"
  28. #endif
  29.  
  30. /* SNMP MIB variables, used for statistics and control. See RFC 1066 */
  31. extern struct mib_entry Udp_mib[];
  32. #define udpInDatagrams  Udp_mib[1].value.integer
  33. #define udpNoPorts      Udp_mib[2].value.integer
  34. #define udpInErrors     Udp_mib[3].value.integer
  35. #define udpOutDatagrams Udp_mib[4].value.integer
  36. #define NUMUDPMIB       4
  37.  
  38. /* User Datagram Protocol definitions */
  39.  
  40. /* Structure of a UDP protocol header */
  41. struct udp {
  42.     int16 source;   /* Source port */
  43.     int16 dest;     /* Destination port */
  44.     int16 length;   /* Length of header and data */
  45.     int16 checksum; /* Checksum over pseudo-header, header and data */
  46. };
  47. #define UDPHDR  8       /* Length of UDP header */
  48.  
  49. /* User Datagram Protocol control block
  50.  * Each entry on the receive queue consists of the
  51.  * remote socket structure, followed by any data
  52.  */
  53. struct udp_cb {
  54.     struct udp_cb *next;
  55.     struct socket socket;   /* Local port accepting datagrams */
  56.     void (*r_upcall) __ARGS((struct iface *iface,struct udp_cb *,int));
  57.                 /* Function to call when one arrives */
  58.     struct mbuf *rcvq;      /* Queue of pending datagrams */
  59.     int rcvcnt;             /* Count of pending datagrams */
  60.     int user;               /* User link */
  61. };
  62. extern struct udp_cb *Udps;     /* Hash table for UDP structures */
  63. #define NULLUDP (struct udp_cb *)0
  64.  
  65. /* UDP primitives */
  66.  
  67. /* In udp.c: */
  68. int del_udp __ARGS((struct udp_cb *up));
  69. struct udp_cb *open_udp __ARGS((struct socket *lsocket,
  70.     void (*r_upcall) __ARGS((struct iface *iface,struct udp_cb *,int))));
  71. int recv_udp __ARGS((struct udp_cb *up,struct socket *fsocket,struct mbuf **bp));
  72. int send_udp __ARGS((struct socket *lsocket,struct socket *fsocket,int tos,
  73.     int ttl,struct mbuf *data,int length,int id,int df));
  74. void udp_input __ARGS((struct iface *iface,struct ip *ip,struct mbuf *bp,
  75.     int rxbroadcast));
  76. void udp_garbage __ARGS((int drastic));
  77.  
  78. #ifdef HOPCHECK
  79. void udp_icmp __ARGS((int32 icsource, int32 ipsource,int32 ipdest,
  80.     int ictype,int iccode,struct mbuf **bpp));
  81. /* In hop.c: */
  82. void hop_icmp __ARGS((struct udp_cb *ucb, int32 icsource, int32 ipdest,
  83.     int udpdest, int ictype, int iccode));
  84. #endif
  85.  
  86. /* In udpcmd.c: */
  87. int st_udp __ARGS((struct udp_cb *udp,int n));
  88.  
  89. /* In udphdr.c: */
  90. struct mbuf *htonudp __ARGS((struct udp *udp,struct mbuf *data,struct pseudo_header *ph));
  91. int ntohudp __ARGS((struct udp *udp,struct mbuf **bpp));
  92. int16 udpcksum __ARGS((struct mbuf *bp));
  93.  
  94. /* In udpsocket.c: */
  95. int so_udp __ARGS((struct usock *up,int protocol));
  96. int so_udp_bind __ARGS((struct usock *up));
  97. int so_udp_conn __ARGS((struct usock *up));
  98. int so_udp_recv __ARGS((struct usock *up,struct mbuf **bpp,char *from,
  99.     int *fromlen));
  100. int so_udp_send __ARGS((struct usock *up,struct mbuf *bp,char *to));
  101. int so_udp_qlen __ARGS((struct usock *up,int rtx));
  102. int so_udp_shut __ARGS((struct usock *up,int how));
  103. int so_udp_close __ARGS((struct usock *up));
  104. int so_udp_stat __ARGS((struct usock *up));
  105.  
  106. #endif  /* _UDP_H */
  107.